/////////////////////////////////
*** Replication materials
*** "Economic Self-Interest or Cultural Threat? Migrant Unemployment and 
*** Class-based Support for Populist Radical Right Parties in Europe"
*** Cordero, Zagórski & Rama (2023)
*** Political Behavior 
/////////////////////////////////

* Variables:
* pspwght pweight cntry idno regoecd PRRP ForBornPop2015 UnemployRateT1 UnemployRateT1_r EUForBornUnempl2015 EUForBornUnempl2015_r NonEUForBornUnemplo2015 NonEUForBornUnemplo2015_r 
* sex age18_7cat habitat *educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad uempla bfttaxgir class5_r hhincome

* WEIGHT = anweight
gen anweight=pspwght*pweight 
sum anweight

* Table 1 & Figure 1
eststo m31ax: melogit PRRP c.UnemployRateT1         		     c.ForBornPop2015 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir i.class5_r   [pweight=anweight] || cntry:   || regoecd:
eststo m32ax: melogit PRRP c.UnemployRateT1##i.class5_r   	     c.ForBornPop2015 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir              [pweight=anweight] || cntry:   || regoecd:
margins, at(UnemployRateT1=(2.7(1.113333333333333)19.4)) over(class5_r) level(95) 
marginsplot, noci level(95) xlabel(0(5)20)  ///
addplot(histogram UnemployRateT1_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))	

eststo m33ax: melogit PRRP c.EUForBornUnempl2015                 c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir i.class5_r  [pweight=anweight] || cntry:  || regoecd:
eststo m34ax: melogit PRRP c.EUForBornUnempl2015##i.class5_r   	 c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir             [pweight=anweight] || cntry:  || regoecd:
margins, at(EUForBornUnempl2015=(2.8(1.366666666666667)23.3)) over(class5_r) level(95) 
marginsplot, noci level(95) xlabel(0(5)25)  ///
addplot(histogram EUForBornUnempl2015_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))

eststo m35ax: melogit PRRP c.NonEUForBornUnemplo2015         				    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir i.class5_r  [pweight=anweight] || cntry:  || regoecd:
eststo m36ax: melogit PRRP c.NonEUForBornUnemplo2015##i.class5_r   			    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir             [pweight=anweight] || cntry: 	|| regoecd:
margins, at(NonEUForBornUnemplo2015=(5.5(1.62)29.8)) over(class5_r) level(95) 
marginsplot, noci level(95) xlabel(0(5)30)  ///
addplot(histogram NonEUForBornUnemplo2015_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))	

esttab m31ax m32ax m33ax m34ax m35ax m36ax using Tab1_final.rtf, ///
	label title (Table 1)  ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	b(2) se(2) not  nogaps onecell ///
	scalars("ll Log lik."  aic) ///
	varlabels(_cons Constant) replace
	
	
*** ONLINE APPENDIX

*Table A1 descriptives
sum PRRP ForBornPop2015 UnemployRateT1 EUForBornUnempl2015 NonEUForBornUnemplo2015 ///
sex age18_7cat habitat educ3  ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad uempla  bfttaxgir class5_r , sep(0)

** Table A2 is full Table 1

* Table A3 full Table 1 with restricted sample
eststo m31ax: melogit PRRP c.UnemployRateT1         				    	    c.ForBornPop2015   i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir i.class5_r if ForBornPop2015!=. &  UnemployRateT1!=. &  EUForBornUnempl2015!=. &  NonEUForBornUnemplo2015!=.  [pweight=anweight] || cntry: 	 || regoecd:
eststo m32ax: melogit PRRP c.UnemployRateT1##i.class5_r   			    	    c.ForBornPop2015   i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir if ForBornPop2015!=. &  UnemployRateT1!=. &  EUForBornUnempl2015!=. &  NonEUForBornUnemplo2015!=. [pweight=anweight] || cntry: 		 || regoecd:
eststo m33ax: melogit PRRP c.EUForBornUnempl2015         				    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir i.class5_r if ForBornPop2015!=. &  UnemployRateT1!=. &  EUForBornUnempl2015!=. &  NonEUForBornUnemplo2015!=. [pweight=anweight] || cntry: 	 || regoecd:
eststo m34ax: melogit PRRP c.EUForBornUnempl2015##i.class5_r   			    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir if ForBornPop2015!=. &  UnemployRateT1!=. &  EUForBornUnempl2015!=. &  NonEUForBornUnemplo2015!=. [pweight=anweight] || cntry: 		 || regoecd:
eststo m35ax: melogit PRRP c.NonEUForBornUnemplo2015         				    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir i.class5_r if ForBornPop2015!=. &  UnemployRateT1!=. &  EUForBornUnempl2015!=. &  NonEUForBornUnemplo2015!=. [pweight=anweight] || cntry: || regoecd:
eststo m36ax: melogit PRRP c.NonEUForBornUnemplo2015##i.class5_r   			    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir if ForBornPop2015!=. &  UnemployRateT1!=. &  EUForBornUnempl2015!=. &  NonEUForBornUnemplo2015!=. [pweight=anweight]	 || cntry: 	 || regoecd:

esttab m31ax m32ax m33ax m34ax m35ax m36ax using TableA3_final.rtf, ///
	label title (Table A3)  ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	b(2) se(2) not  nogaps onecell ///
	scalars("ll Log lik."  aic) ///
	varlabels(_cons Constant) replace

* Table A4
* standardized unemployment
egen stdUnemployRateT1 = std(UnemployRateT1)
sum stdUnemployRateT1

egen stdEUForBornUnempl2015 = std(EUForBornUnempl2015)
sum stdEUForBornUnempl2015

egen stdNonEUForBornUnemplo2015 = std(NonEUForBornUnemplo2015)
sum stdNonEUForBornUnemplo2015

eststo m31ay: melogit PRRP c.stdUnemployRateT1         				    	    	c.ForBornPop2015  i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir i.class5_r   				 [pweight=anweight] || cntry:  || regoecd: 
eststo m32ay: melogit PRRP c.stdUnemployRateT1##i.class5_r   			    	    c.ForBornPop2015  i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir 							 [pweight=anweight] || cntry:  || regoecd:
eststo m33ay: melogit PRRP c.stdEUForBornUnempl2015         				    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir i.class5_r  [pweight=anweight] || cntry:  || regoecd: 
eststo m34ay: melogit PRRP c.stdEUForBornUnempl2015##i.class5_r   			    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir 			 [pweight=anweight] || cntry:  || regoecd:
eststo m35ay: melogit PRRP c.stdNonEUForBornUnemplo2015         				    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir i.class5_r  [pweight=anweight] || cntry:  || regoecd: 
eststo m36ay: melogit PRRP c.stdNonEUForBornUnemplo2015##i.class5_r   			    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir 			 [pweight=anweight]	|| cntry:  || regoecd:

esttab m31ay m32ay m33ay m34ay m35ay m36ay using TableA4_final.rtf, ///
	label title (Table A4)  ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	b(2) se(2) not  nogaps onecell ///
	scalars("ll Log lik."  aic) ///
	varlabels(_cons Constant) replace
	
	
* Figure A1	
melogit PRRP c.UnemployRateT1##c.hhincome   			    	    c.ForBornPop2015   i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight] || cntry:  || regoecd:
margins, dydx(hhincome) at(UnemployRateT1=(2.7(1.113333333333333)19.4)) level(95)
marginsplot,  level(95) xlabel(0(5)20)  ///
addplot(histogram UnemployRateT1_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))

melogit PRRP c.EUForBornUnempl2015##c.hhincome  			    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla  bfttaxgir [pweight=anweight] || cntry: 	 || regoecd:
margins, dydx(hhincome) at(EUForBornUnempl2015=(2.8(1.366666666666667)23.3)) level(95) 
marginsplot,  level(95) xlabel(0(5)25)  ///
addplot(histogram EUForBornUnempl2015_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))

melogit PRRP c.NonEUForBornUnemplo2015##c.hhincome   			    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight]	 || cntry: 	 || regoecd:
margins, dydx(hhincome) at(NonEUForBornUnemplo2015=(5.5(1.62)29.8))  level(95) 
marginsplot,  level(95) xlabel(0(5)30)  ///
addplot(histogram NonEUForBornUnemplo2015_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))	

	
* Figure A2
melogit PRRP c.UnemployRateT1##ib5.class5_r   			    	    c.ForBornPop2015   i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight] || cntry: || regoecd: , vce(robust)
margins, dydx(class5_r) at(UnemployRateT1=(2.7(1.113333333333333)19.4)) level(95)  
marginsplot, level(95) xlabel(0(5)20)  ///
addplot(histogram UnemployRateT1_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))	

melogit PRRP c.EUForBornUnempl2015##ib5.class5_r   			    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight] || cntry: || regoecd: , vce(robust)
margins, dydx(class5_r) at(EUForBornUnempl2015=(2.8(1.366666666666667)23.3))  level(95) 
marginsplot, level(95) xlabel(0(5)25)  ///
addplot(histogram EUForBornUnempl2015_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))

melogit PRRP c.NonEUForBornUnemplo2015##ib5.class5_r   			    c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight]	 || cntry: || regoecd: , vce(robust)
margins, dydx(class5_r) at(NonEUForBornUnemplo2015=(5.5(1.62)29.8))  level(95)  
marginsplot, level(95) xlabel(0(5)30)  ///
addplot(histogram NonEUForBornUnemplo2015_r, blcolor(gs10) fcolor(gs10) percent yaxis(2) ///
yscale(alt range(0 200) lcolor() axis(2)))	


* Figure A3
//// REGIONAL UNEMPLOYMENT
melogit PRRP c.UnemployRateT1##i.class5_r   			    	 c.ForBornPop2015   i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight] || cntry:  || regoecd: , vce(robust)
margins class5_r, at(UnemployRateT1=(2.7(1.113333333333333)19.4)) level(95)  post

mat t = e(at)
mat t = t[1...,"UnemployRateT1"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#2.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = mat1 mdif1 mll1 mul1
svmat t, names(col)

twoway (line mdif1 mat1)(line mll1 mat1)(line mul1 mat1),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(Regional unemployment) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Lower-grade class difference)

*
mat t = e(at)
mat t = t[1...,"UnemployRateT1"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#3.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = mat13 mdif13 mll13 mul13
svmat t, names(col)

twoway (line mdif13 mat13)(line mll13 mat13)(line mul13 mat13),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(Regional unemployment) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - small-business owners class difference)
*
mat t = e(at)
mat t = t[1...,"UnemployRateT1"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#4.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = mat14 mdif14 mll14 mul14
svmat t, names(col)

twoway (line mdif14 mat14)(line mll14 mat14)(line mul14 mat14),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(Regional unemployment) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - skilled workers class difference)
*
mat t = e(at)
mat t = t[1...,"UnemployRateT1"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#5.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = mat15 mdif15 mll15 mul15
svmat t, names(col)

twoway (line mdif15 mat15)(line mll15 mat15)(line mul15 mat15),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(Regional unemployment) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - unskilled workers class difference)


//// EU UNEMPLOYEMENT
melogit PRRP c.EUForBornUnempl2015##ib5.class5_r   			    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight] || cntry:  || regoecd: , vce(robust)
margins class5_r, at(EUForBornUnempl2015=(2.8(1.366666666666667)23.3))  level(95) post

mat t = e(at)
mat t = t[1...,"EUForBornUnempl2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#2.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = at1eumul dif1eumul ll1eumul ul1eumul
svmat t, names(col)

twoway (line dif1eumul at1eumul)(line ll1eumul at1eumul)(line ul1eumul at1eumul),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(EUForBornUnempl2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Lower-grade class difference) 
*
mat t = e(at)
mat t = t[1...,"EUForBornUnempl2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#3.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = at2eumul1 dif2eumul1 ll2eumul1 ul2eumul1
svmat t, names(col)

twoway (line dif2eumul1 at2eumul1)(line ll2eumul1 at2eumul1)(line ul2eumul1 at2eumul1),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(EUForBornUnempl2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Small business owners class difference)
*	  
mat t = e(at)
mat t = t[1...,"EUForBornUnempl2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#4.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = at3eumul2 dif3eumul2 ll3eumul2 ul3eumul2
svmat t, names(col)

twoway (line dif3eumul2 at3eumul2)(line ll3eumul2 at3eumul2)(line ul3eumul2 at3eumul2),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(EUForBornUnempl2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Skilled workers class difference)  	   
	   
*
mat t = e(at)
mat t = t[1...,"EUForBornUnempl2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#5.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = ateumul3 difeumul3 lleumul3 uleumul3
svmat t, names(col)

twoway (line difeumul3 ateumul3)(line lleumul3 ateumul3)(line uleumul3 ateumul3),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(EUForBornUnempl2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - unskilled workers difference)
		 
///// TCN UNEMPLOYEMENT
melogit PRRP c.NonEUForBornUnemplo2015##ib5.class5_r   			    	c.ForBornPop2015  c.UnemployRateT1 i.sex i.age18_7cat i.habitat i.educ3 ideolo immigr_worst eurosceptic notrustparties ecosociocurrentbad i.uempla bfttaxgir [pweight=anweight] || cntry:  || regoecd: , vce(robust)
margins class5_r, at(NonEUForBornUnemplo2015=(5.5(1.62)29.8))  level(95) post

mat t = e(at)
mat t = t[1...,"NonEUForBornUnemplo2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#2.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = at1eunon1 dif1eunon1 ll1eunon1 ul1eunon1
svmat t, names(col)

twoway (line dif1eunon1 at1eunon1)(line ll1eunon1 at1eunon1)(line ul1eunon1 at1eunon1),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(NonEUForBornUnemplo2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Lower-grade class difference)
	   
*Higher-grade class - Small business owners class difference
mat t = e(at)
mat t = t[1...,"NonEUForBornUnemplo2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#3.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = at2eunon2 dif2eunon2 ll2eunon2 ul2eunon2
svmat t, names(col)

twoway (line dif2eunon2 at2eunon2)(line ll2eunon2 at2eunon2)(line ul2eunon2 at2eunon2),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(NonEUForBornUnemplo2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Small business owners class difference)
	   
* Higher-grade class - Skilled workers class difference	   
mat t = e(at)
mat t = t[1...,"NonEUForBornUnemplo2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#4.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = at3eunon3 dif3eunon3 ll3eunon3 ul3eunon3
svmat t, names(col)

twoway (line dif3eunon3 at3eunon3)(line ll3eunon3 at3eunon3)(line ul3eunon3 at3eunon3),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(NonEUForBornUnemplo2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - Skilled workers class difference)  	   
 	   
* Higher-grade class - unskilled workers difference 
mat t = e(at)
mat t = t[1...,"NonEUForBornUnemplo2015"]
mat list t
mat t = t,J(16,3,.)
mat list t

forvalue i=1/16 {
  quietly lincom _b[`i'._at#1.class5_r]-_b[`i'._at#5.class5_r]
  mat t[`i',2] = r(estimate)
  mat t[`i',3] = r(estimate) - 1.96*r(se)
  mat t[`i',4] = r(estimate) + 1.96*r(se)
}

mat colnames t = ateunon4 difeunon4 lleunon4 uleunon4
svmat t, names(col)

twoway (line difeunon4 ateunon4)(line lleunon4 ateunon4)(line uleunon4 ateunon4),                                 ///
       yline(0) legend(off)                                                   ///
       xtitle(NonEUForBornUnemplo2015) ytitle(Probability difference (voting PRRP)) ///
       title(Higher-grade class - unskilled workers difference)


/// End	
